import {TOKENNAME, HTTP_REQUEST_URL} from '@/config/app.js';
import store from '@/store';
export function upvideofile (r){
	return new Promise((resolve,reject)=>{
		uni.uploadFile({
		    url: HTTP_REQUEST_URL + '/api/upload/video/field', 
		    filePath: r,
		    name: 'field',
			success: res => {
				console.log(res,1)
				var r = JSON.parse(res.data)
				resolve(r)
			},
			fail: err => {}
		})
	})
}

export function upimgfile (r){
	return new Promise((resolve,reject)=>{
		uni.uploadFile({
		    url: HTTP_REQUEST_URL + '/api/upload/image/field', 
		    filePath: r,
		    name: 'field',
			formData: {
				'filename': r,
				// 'name': that.imgName
			},
			header: {
				// #ifdef MP
				"Content-Type": "multipart/form-data",
				// #endif
				[TOKENNAME]: 'Bearer ' + store.state.app.token
			},
			success: res => {
				console.log(res,1)
				var r = JSON.parse(res.data)
				resolve(r)
			},
			fail: err => {}
		})
	})
}